<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" pageEncoding="UTF-8" isELIgnored="false" %>
<HTML>
<HEAD>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="${pageContext.request.contextPath}/css/Style1.css" rel="stylesheet" type="text/css"/>
    <%--<script language="javascript" src="${pageContext.request.contextPath}/js/public.js"></script>--%>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css"
          type="text/css"/>
    <script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"
            type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"
            type="text/javascript"></script>
</HEAD>
<body>
<br>
<form id="Form1" name="Form1" action="${pageContext.request.contextPath}/user/list.jsp"
      method="post">
    <table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
        <TBODY>
        <tr>
            <td class="ta_01" align="center" bgColor="#afd1f3">
                <strong>用户列表</strong>
            </TD>
        </tr>
        <tr>

        </tr>
        <tr>
            <td class="ta_01" align="center" bgColor="#f5fafe">
                <table cellspacing="0" cellpadding="1" rules="all"
                       bordercolor="gray" border="1" id="DataGrid1"
                       style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
                    <tr
                            style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3">

                        <td align="center" width="18%">
                            序号
                        </td>
                        <td align="center" width="17%">
                            用户名称
                        </td>
                        <td align="center" width="17%">
                            真实姓名
                        </td>
                        <td width="7%" align="center">
                            编辑
                        </td>
                        <td width="7%" align="center">
                            删除
                        </td>
                    </tr>
                    <c:forEach items="${requestScope.page.list}" var="item" varStatus="vs">
                        <tr onmouseover="this.style.backgroundColor = 'white'"
                            onmouseout="this.style.backgroundColor = '#F5FAFE';" id="${item.uid}">
                            <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                                width="18%">${vs.count}
                            </td>
                            <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                                width="17%">
                                    ${item.username}
                            </td>
                            <td style="CURSOR: hand; HEIGHT: 22px" align="center"
                                width="17%">
                                    ${item.name}
                            </td>
                            <td align="center" style="HEIGHT: 22px">
                                <a href="${ pageContext.request.contextPath }/admin/user/findUserByUid.do?uid=${item.uid}">
                                    <img src="${pageContext.request.contextPath}/images/i_edit.gif" border="0"
                                         style="CURSOR: hand">
                                </a>
                            </td>
                            <td align="center" style="HEIGHT: 22px">
                                <a href="javascript:void(0)" onclick="deleteByUid('${item.uid}')">
                                    <img src="${pageContext.request.contextPath}/images/i_del.gif" width="16"
                                         height="16" border="0" style="CURSOR: hand">
                                </a>
                            </td>
                        </tr>
                    </c:forEach>

                </table>
                <h3 align="center">
                    <ul class="pagination">
                        <c:if test="${requestScope.page.pageNum!=1}">
                            <li>
                                <a href="${pageContext.request.contextPath}/admin/user/findUsers.do?pageNum=${requestScope.page.pageNum-1}"
                                   aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                        </c:if>
                        <c:if test="${requestScope.page.pageNum==1}">
                            <li>
                                <a href="#" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                        </c:if>
                        <!--
                                    navigateFirstPage    start
                                    navigateLastPage     end
                                    -->
                        <c:forEach begin="${requestScope.page.navigateFirstPage}"
                                   end="${requestScope.page.navigateLastPage}" var="i" step="1">
                            <c:if test="${requestScope.page.pageNum==i}">
                                <li class="active"><a
                                        href="${pageContext.request.contextPath}/admin/user/findUsers.do?pageNum=${i}">${i}</a>
                                </li>
                            </c:if>
                            <c:if test="${requestScope.page.pageNum!=i}">
                                <li>
                                    <a href="${pageContext.request.contextPath}/admin/user/findUsers.do?pageNum=${i}">${i}</a>
                                </li>
                            </c:if>
                        </c:forEach>

                        <c:if test="${requestScope.page.pageNum!=requestScope.page.pages}">
                            <li>
                                <a href="${pageContext.request.contextPath}/admin/user/findUsers.do?pageNum=${requestScope.page.nextPage}"
                                   aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </c:if>
                        <c:if test="${requestScope.page.pageNum==requestScope.page.pages}">
                            <li>
                                <a href="#" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </c:if>
                    </ul>
                </h3>
            </td>
        </tr>
        </TBODY>
    </table>
</form>
<script>
    function deleteByUid(uid) {
        $.ajax(
            {
                url: "/admin/user/deleteById.do",
                data: {
                    uid: uid
                },
                success: function (uid) {
                    $("#" + uid).remove()
                }
            }
        )
    }
</script>

</body>
</HTML>

